﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Chaos.messages
{
    public class request_chat_text : message
    {
        String text;
        public String Text
        {
            get { return text; }
            set { text = value; }
        }

        public override void process(context in_context)
        {
            network.gameserver s = System.Windows.Application.Current.FindResource("game_server") as network.gameserver;
            if (s != null)
            {
                process_chat_text msg = new process_chat_text();
                msg.Text = text;
                msg.User = in_context.Connection.User;
                s.BroadcastMessage(msg);
            }          
        }

        public override void serialize(stream.stream in_Stream)
        {
            in_Stream.begin("request_chat_text")
                .serialize("text", ref text)
            .end();
        }
    }
}
